package com.ericpol.pageobject.copy;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;

public class SeleniumBasic {

	protected WebDriver driver;

	@BeforeMethod
	public void setUp() throws Exception {
		driver = selectDriver("HtmlUnitDriver");
		driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
	}

	@AfterMethod
	public void tearDown() throws Exception {
		driver.quit();

	}

	public WebDriver selectDriver(String drivername) {
		if (drivername.equals("InternetExplorer")) {
			return new InternetExplorerDriver();
		} else if (drivername.equals("HtmlUnitDriver")) {
			return new HtmlUnitDriver();
		}
		driver = new FirefoxDriver();
		return driver;
	}

}